package br.com.fmu.projeto_android_tcc_2014;

import br.com.fmu.projeto_android_tcc_2014.bean.UsuarioBean;
import br.com.fmu.projeto_android_tcc_2014.dao.Android_TCC_DAO;
import br.com.fmu.projeto_android_tcc_2014.helper.Android_Formulario_Helper;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class TCC_Formulario_Activity extends Activity {
	
	private Button btn_SalvarUsuario;
	public Android_Formulario_Helper helper;
	public Android_TCC_DAO tcc_DAO;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.formulario_activity);
		
		btn_SalvarUsuario = (Button) findViewById(R.id.btn_Salvar);
		btn_SalvarUsuario.setOnClickListener(new OnClickListener() {
			
			public void onClick(View view) {
				
				helper = new Android_Formulario_Helper(TCC_Formulario_Activity.this);
				UsuarioBean bean = helper.recuperaUsuario();
				
				tcc_DAO = new Android_TCC_DAO(TCC_Formulario_Activity.this);
				tcc_DAO.inserirUsuario(bean);
				tcc_DAO.close();
				
				finish();
			}
		});
		
	}
}
